package com.fqgj.sentry.controller.pc.response;

import com.fqgj.common.utils.CollectionUtils;
import com.fqgj.sentry.policy.entity.RiskDataModulesEntity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2020-11-03
 * Time: 09:56
 */
public class DataModuleListResponse {

    private List<Item> list = new ArrayList<>();

    public DataModuleListResponse(List<RiskDataModulesEntity> data) {
        if (!CollectionUtils.isEmpty(data)) {
            data.forEach(d -> {
                Item item = new Item()
                        .setModuleCode(d.getModuleCode())
                        .setModuleName(d.getModuleName());
                list.add(item);
            });
        }
    }

    public List<Item> getList() {
        return list;
    }

    public DataModuleListResponse setList(List<Item> list) {
        this.list = list;
        return this;
    }

    private class Item {
        private String moduleCode;
        private String moduleName;

        public String getModuleCode() {
            return moduleCode;
        }

        public Item setModuleCode(String moduleCode) {
            this.moduleCode = moduleCode;
            return this;
        }

        public String getModuleName() {
            return moduleName;
        }

        public Item setModuleName(String moduleName) {
            this.moduleName = moduleName;
            return this;
        }
    }
}
